home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / gnulib / libsrc98.zoo / fork.h < prev    next >
C/C++ Source or Header  |  1991-05-23  |  1KB  |  45 lines

  1. /*
  2.  * type definitions needed by fork() and exec().
  3.  */
  4.  
  5. #ifndef _FORK_H
  6. #define _FORK_H
  7.  
  8. #ifndef _SETJMP_H
  9. #include <setjmp.h>
  10. #endif
  11. #ifndef _BASEPAGE_H
  12. #include <basepage.h>
  13. #endif
  14.  
  15. #ifndef _COMPILER_H
  16. #include <compiler.h>
  17. #endif
  18.  
  19. struct _fork_block
  20. {
  21.     struct _fork_block *next;
  22.     jmp_buf    ctxt;            /* saved context of the fork */
  23.     long    *start_addr;        /* address for saved data */
  24.     long    data_size;        /* size of saved data (in words) */
  25.     BASEPAGE *ppid;            /* parent's basepage */
  26.     BASEPAGE *pid;            /* child's basepage */
  27.     short    return_code;        /* exit value from Pexec */
  28.     long    tmp_stack[64];        /* temporary stack for Pexec */
  29.     long    data[0];        /* saved data goes here */
  30. };
  31.  
  32. extern struct _fork_block *_forks;
  33.  
  34. /*
  35.  *  macro to convert a basepage to a pid; should match what's done in
  36.  *  getpid.c
  37.  */
  38.  
  39. #define BP_TO_PID(x) ((int)(0x7fff & (((unsigned long)(x)) >> 8)))
  40.  
  41. __EXTERN int _fork __PROTO((char *save_to));
  42. __EXTERN int _wait __PROTO((int  *exit_code));
  43.  
  44. #endif /* _FORK_H */
  45.